package com.love.cloud.admin.controller;

import com.love.cloud.admin.api.entity.SysDept;
import com.love.cloud.admin.api.vo.LocalDeptInfoVo;
import com.love.cloud.admin.api.vo.LocalUserInfoVo;
import com.love.cloud.admin.api.vo.LocalUserTreeVo;
import com.love.cloud.admin.dto.LocalUserInfoDto;
import com.love.cloud.admin.dto.LocalUserTreeDto;
import com.love.cloud.admin.service.SelectDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author hongdongqu
 */
@RestController
@RequestMapping("/selectData")
@Api(tags = "选择数据接口")
public class SelectDataController {
    @Resource
    private SelectDataService selectDataService;

    @GetMapping("/getDeptAndUserInfo")
    @ApiOperation(value = "获取到对应部门下发的部门和用户数据")
    public LocalUserTreeDto getDeptAndUserInfo(LocalUserTreeVo localUserTreeVo){
        return selectDataService.getDeptAndUserInfo(localUserTreeVo);
    }

    @GetMapping("/getUserInfo")
    @ApiOperation(value = "检索对应的用户信息")
    public List<LocalUserInfoDto> getUserInfo(LocalUserInfoVo localUserInfoVo){
        return selectDataService.getUserInfo(localUserInfoVo);
    }

    @GetMapping("/searchLocalDeptInfo")
    @ApiOperation(value = "检索对应的用户信息")
    public List<SysDept> searchLocalDeptInfo(LocalDeptInfoVo localDeptInfoVo){
        return selectDataService.searchLocalDeptInfo(localDeptInfoVo);
    }
}
